package org.thss.petri.gef.editparts;

import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartFactory;
import org.thss.petri.model.Arc;
import org.thss.petri.model.PetriNet;
import org.thss.petri.model.Place;
import org.thss.petri.model.Token;
import org.thss.petri.model.Transition;


public class GraphicalEditPartFactory implements EditPartFactory {

	@Override
	public EditPart createEditPart(EditPart context, Object obj) {
		if(obj instanceof PetriNet) {
			return new PetriNetEditPart((PetriNet) obj);
		}
		else if (obj instanceof Place) {
			return new PlaceEditPart((Place) obj);
		}
		else if (obj instanceof Transition) {
			return new TransitionEditPart((Transition) obj);
		}
		else if (obj instanceof Arc) {
			return new ArcEditpart((Arc) obj);
		}
		else if (obj instanceof Token) {
			return new TokenEditPart((Token) obj);
		}
		
		return null;
	}

}
